package com.example.kuaizu.mapper;

import com.example.kuaizu.pojo.ov.ProjectInterestedOv;
import com.example.kuaizu.pojo.pram.GetTalentParam;
import kuaizu.common.tablepojo.OliveBranch;
import kuaizu.common.tablepojo.TalentDB;
import kuaizu.common.tablepojo.TalentReview;
import kuaizu.common.vo.TalentListVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author: wangmx15
 * @date: 2025/9/18
 **/
@Mapper
public interface TalentMapper {

    int insertTalent(TalentDB talentDB);

    List<TalentListVo> getTalentList(GetTalentParam req);

    TalentListVo queryTalentInfoByOpenId(@Param("openid") String openid,@Param("status") boolean status);

    void updateTalent(TalentDB talent);

    void updateMyTalentStatus(String openid);

    @Select("SELECT * FROM olive_branch where openid = #{openid}")
    OliveBranch queryOliveBranchCont(String openid);

    @Insert("insert into talent_review (openid,talent_id,project_id,is_approved,application_time) value (#{p.openid},#{p.talentId},#{p.projectId},#{p.isApproved},#{p.applicationTime})")
    void insertTalentReview(@Param("p") TalentReview talentReview);

    List<ProjectInterestedOv> queryProjectByOpenId(String openid);

    @Select("select * from talent_review where id = #{id} ")
    TalentReview queryTalentReviewById(Integer id);

    @Update("update talent_review set is_approved = #{isApproved} , review_time = #{reviewTime}  where id = #{id}")
    void updateTalentReview(TalentReview tr);
}
